package com.health.system.mapper;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.health.system.entity.HealthRules;
import org.apache.ibatis.annotations.Mapper;

/**
 * <p>
 *  Mapper 接口
 * </p>
 *
 * @author baomidou
 * @since 2024-06-22
 */
@Mapper
public interface HealthRulesMapper extends BaseMapper<HealthRules> {

    default HealthRules getStarsForScore(Integer totalScore) {
        return this.selectOne(new QueryWrapper<HealthRules>()
                        .le("min_score", totalScore)
                        .ge("max_score", totalScore));
    }
}